import pyshark as pyshark
from scapy.all import *

LOG = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)


def show_log(packet):
    LOG.debug(packet)


class Sniffer(object):
    def __init__(self, iface='wlp2s0', prn=show_log):
        self.prn = prn
        self.capture = pyshark.LiveCapture(interface=iface)

    def sniff(self):
        self.capture.apply_on_packets(callback=self.prn)


if __name__ == '__main__':
    sniffer = Sniffer()
    sniffer.sniff()
